package com.xl.gradledemo


import android.util.Log
import androidx.databinding.ViewDataBinding
import com.xl.checkshake.Checkshake
import com.xl.gradledemo.base.BaseActivity
import com.xl.gradledemo.databinding.ActivityMainBinding


class MainActivity : BaseActivity() {

    private val TAG = "MainActivity"
    override fun getLayout(): Int {
        return R.layout.activity_main
    }

    override fun getBinding(viewDataBinding: ViewDataBinding) {
        val mainBinding: ActivityMainBinding = viewDataBinding as ActivityMainBinding

        mainBinding.btn1.setOnClickListener {
            test1()
        }

        mainBinding.btn2.setOnClickListener {
            test2()
        }
    }




    fun test1() {
        val time1 = System.currentTimeMillis()
        for (i in 1..100000) {
            Checkshake.getLock(1) {

            }
        }
        val time2 = System.currentTimeMillis() - time1
        Log.e(TAG, "消耗时间1: $time2")
    }


    fun test2() {
        val time1 = System.currentTimeMillis()
        for (i in 1..100000) {
            Checkshake.getLock(2, 2) {

            }
        }
        val time2 = System.currentTimeMillis() - time1
        Log.e(TAG, "消耗时间2: $time2")
    }

}